package org.leiyang.gateway.service;

import org.leiyang.common.dtos.MsgServerInfo;
import org.leiyang.common.holder.OnlineServerHolder;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

/**
 * 操作MsgServer
 */
@Component
public class MsgServerServiceImpl {

    private final OnlineServerHolder onlineServerHolder;

    public MsgServerServiceImpl(OnlineServerHolder onlineServerHolder) {
        this.onlineServerHolder = onlineServerHolder;
    }

    /**
     * 获取当前连接数最少的msg_server
     */
    public Mono<MsgServerInfo> chooseMostIdleServer() {
        return onlineServerHolder.chooseMostIdleServer();
    }
}